﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.SqlClient;
using System.Data;
using myomscl.Utils;

namespace myomscl.DataObjects
{
    public class WorkflowFilter
    {
        public Int32? AlertId { get; set; }
        public Int32 Id { get; set; }
        public Int32? AlertType { get; set; }
        public Int32? ActivityType { get; set; }
        public String NetworkOperatorName { get; set; }
        public Int32? MunicipalityId { get; set; }
        public DateTime? EstimateStartDate { get; set; }
        public DateTime? EstimateEndDate { get; set; }
        public DateTime? StartDate { get; set; }
        public DateTime? EndDate { get; set; }
        public List<Int32> Status { get; set; }
        public Int32? OldStatus { get; set; }
        public Int32? NewStatus { get; set; }
        public Int32? CurrentStatus { get; set; }
        public Int32? AlertArea { get; set; }
        public String Comments { get; set; }
        public Boolean? TrafficProblems { get; set; }
        public String Location { get; set; }
        public String CenterCoordinates { get; set; }
        public String AreaCoordinates { get; set; }
        public Int32? NetworkOperatorId { get; set; }
        public String AlertCode { get; set; }
        public Int32? ContractorId { get; set; }
        public Int32? UserId { get; set; }
        public Int32? ContactUser { get; set; }
        public Int32? CreatedUser { get; set; }
        public Int32? MaterialsId { get; set; }
        public String FirstName { get; set; }
        public String LastName { get; set; }
        public String Phone1 { get; set; }
        public String Phone2 { get; set; }
        public String Email { get; set; }
        public String Login { get; set; }
        public String Password { get; set; }
        public Boolean Confirmation { get; set; }
        public Boolean Notification { get; set; }
        public String Code { get; set; }
        public String Name { get; set; }
        public String PostAddress { get; set; }
        public String PostCode { get; set; }
        public String PostCity { get; set; }
        public Boolean Disabled { get; set; }
        public Double? Price { get; set; }
        public Int32? Unit { get; set; }
        public String OldPassword { get; set; }
        public String NewPassword { get; set; }
        public String Search { get; set; }
        public String TrafficComments { get; set; }
        public float? StartFee { get; set; }
        public float? ConstructorPrice { get; set; }
        public Boolean? UseMunicipConstractor { get; set; }
        public Int32? Days { get; set; }
        public Boolean Archive { get; set; }
        public List<string> Ids { get; set; }
    }

    public class WorkflowFilterSql
    {
        private readonly WorkflowFilter filter;

        public WorkflowFilterSql(WorkflowFilter baseFilter)
        {
            filter = baseFilter;
        }
        public SqlParameter UseMunicipConstractor
        {
            get
            {
                object usemunicipconstractor = filter.UseMunicipConstractor.HasValue ? filter.UseMunicipConstractor.Value : (object)DBNull.Value;
                return new SqlParameter
                {
                    ParameterName = Constants.Sp_Param_UseMunicipConstractor,
                    Value = usemunicipconstractor,
                    IsNullable = true,
                    SqlDbType = SqlDbType.Bit,
                    Direction = ParameterDirection.Input
                };
            }
        }
        public SqlParameter AlertId
        {
            get
            {
                object alertId = (filter.AlertId.HasValue) ? filter.AlertId : (object)DBNull.Value;
                return new SqlParameter
                {
                    ParameterName = Constants.Sp_Param_AlertId,
                    Value = alertId,
                    IsNullable = false,
                    SqlDbType = SqlDbType.Int,
                    Direction = ParameterDirection.Input
                };
            }
        }
        public SqlParameter Id
        {
            get
            {
                return new SqlParameter
                {
                    ParameterName = Constants.Sp_Param_Id,
                    Value = filter.Id,
                    IsNullable = false,
                    SqlDbType = SqlDbType.Int,
                    Direction = ParameterDirection.Input
                };
            }
        }
        public SqlParameter UserId
        {
            get
            {
                object userId = (filter.UserId.HasValue) ? filter.UserId : (object)DBNull.Value;
                return new SqlParameter
                {
                    ParameterName = Constants.Sp_Param_UserId,
                    Value = userId,
                    IsNullable = false,
                    SqlDbType = SqlDbType.Int,
                    Direction = ParameterDirection.Input
                };
            }
        }
        public SqlParameter AlertType
        {
            get
            {
                object alertType = (filter.AlertType.HasValue) ? filter.AlertType : (object)DBNull.Value;
                return new SqlParameter
                {
                    ParameterName = Constants.Sp_Param_AlertType,
                    Value = alertType,
                    IsNullable = true,
                    SqlDbType = SqlDbType.VarChar,
                    Direction = ParameterDirection.Input
                };
            }
        }
        public SqlParameter ActivityType
        {
            get
            {
                object activityType = (filter.ActivityType.HasValue) ? filter.ActivityType : (object)DBNull.Value;
                return new SqlParameter
                {
                    ParameterName = Constants.Sp_Param_ActivityType,
                    Value = activityType,
                    IsNullable = true,
                    SqlDbType = SqlDbType.Int,
                    Direction = ParameterDirection.Input
                };
            }
        }
        public SqlParameter NetworkOperatorName
        {
            get
            {
                object networkOperatorName = !string.IsNullOrEmpty(filter.NetworkOperatorName) ? filter.NetworkOperatorName : (object)DBNull.Value;
                return new SqlParameter
                {
                    ParameterName = Constants.Sp_Param_NetworkOperatorName,
                    Value = networkOperatorName,
                    IsNullable = true,
                    SqlDbType = SqlDbType.VarChar,
                    Direction = ParameterDirection.Input
                };
            }
        }
        public SqlParameter Search
        {
            get
            {
                object search = !string.IsNullOrEmpty(filter.Search) ? filter.Search : (object)DBNull.Value;
                return new SqlParameter
                {
                    ParameterName = Constants.Sp_Param_Search,
                    Value = search,
                    IsNullable = true,
                    SqlDbType = SqlDbType.VarChar,
                    Direction = ParameterDirection.Input
                };
            }
        }
        public SqlParameter MunicipalityId
        {
            get
            {
                object municipalityId = (filter.MunicipalityId.HasValue) ? filter.MunicipalityId : (object)DBNull.Value;
                return new SqlParameter
                {
                    ParameterName = Constants.Sp_Param_MunicipalityId,
                    Value = municipalityId,
                    IsNullable = true,
                    SqlDbType = SqlDbType.Int,
                    Direction = ParameterDirection.Input
                };
            }
        }
        public SqlParameter ContactUser
        {
            get
            {
                object contactUser = (filter.ContactUser.HasValue) ? filter.ContactUser : (object)DBNull.Value;
                return new SqlParameter
                {
                    ParameterName = Constants.Sp_Param_ContactUser,
                    Value = contactUser,
                    IsNullable = true,
                    SqlDbType = SqlDbType.Int,
                    Direction = ParameterDirection.Input
                };
            }
        }
        public SqlParameter CreatedUser
        {
            get
            {
                object createdUser = (filter.CreatedUser.HasValue) ? filter.CreatedUser : (object)DBNull.Value;
                return new SqlParameter
                {
                    ParameterName = Constants.Sp_Param_CreatedUser,
                    Value = createdUser,
                    IsNullable = true,
                    SqlDbType = SqlDbType.Int,
                    Direction = ParameterDirection.Input
                };
            }
        }
        public SqlParameter EstimateStartDate
        {
            get
            {
                object estimateStartDate = (filter.EstimateStartDate.HasValue)
                                      ? filter.EstimateStartDate
                                      : (object)DBNull.Value;
                return new SqlParameter
                {
                    ParameterName = Constants.Sp_Param_EstimateStartDate,
                    Value = estimateStartDate,
                    IsNullable = true,
                    SqlDbType = SqlDbType.DateTime,
                    Direction = ParameterDirection.Input
                };
            }
        }
        public SqlParameter EstimateEndDate
        {
            get
            {
                object estimateEndDate = (filter.EstimateEndDate.HasValue)
                                      ? filter.EstimateEndDate
                                      : (object)DBNull.Value;
                return new SqlParameter
                {
                    ParameterName = Constants.Sp_Param_EstimateEndDate,
                    Value = estimateEndDate,
                    IsNullable = true,
                    SqlDbType = SqlDbType.DateTime,
                    Direction = ParameterDirection.Input
                };
            }
        }
        public SqlParameter StartDate
        {
            get
            {
                object startDate = (filter.StartDate.HasValue)
                                      ? filter.StartDate
                                      : (object)DBNull.Value;
                return new SqlParameter
                {
                    ParameterName = Constants.Sp_Param_StartDate,
                    Value = startDate,
                    IsNullable = true,
                    SqlDbType = SqlDbType.DateTime,
                    Direction = ParameterDirection.Input
                };
            }
        }
        public SqlParameter EndDate
        {
            get
            {
                object endDate = (filter.EndDate.HasValue)
                                      ? filter.EndDate
                                      : (object)DBNull.Value;
                return new SqlParameter
                {
                    ParameterName = Constants.Sp_Param_EndDate,
                    Value = endDate,
                    IsNullable = true,
                    SqlDbType = SqlDbType.DateTime,
                    Direction = ParameterDirection.Input
                };
            }
        }
        public SqlParameter Status
        {
            get
            {
                object status;
                if (filter.Status == null || filter.Status.Count == 0)
                {
                    status = DBNull.Value;
                }
                else
                {

                    string[] stringArray = Array.ConvertAll<Int32, string>(filter.Status.ToArray(),
                                                                                           new Converter<Int32, string>(ConvertIntToString));

                    status = string.Join(",", stringArray);

                }


                return new SqlParameter
                {
                    ParameterName = Constants.Sp_Param_Status,
                    Value = status,
                    IsNullable = false,
                    SqlDbType = SqlDbType.VarChar,
                    Direction = ParameterDirection.Input
                };
            }
        }
        public SqlParameter Ids
        {
            get
            {
                object ids;
                if (filter.Ids == null || filter.Ids.Count == 0)
                {
                    ids = DBNull.Value;
                }
                else
                {

                    string[] stringArray = filter.Ids.ToArray();
                    ids = string.Join(",", stringArray);
                }

                return new SqlParameter
                {
                    ParameterName = Constants.Sp_Param_Ids,
                    Value = ids,
                    IsNullable = true,
                    SqlDbType = SqlDbType.VarChar,
                    Direction = ParameterDirection.Input
                };
            }
        }
        public SqlParameter OldStatus
        {
            get
            {
                object status = (filter.OldStatus.HasValue) ? (int)filter.OldStatus : (object)DBNull.Value;
                return new SqlParameter
                {
                    ParameterName = Constants.Sp_Param_OldStatus,
                    Value = status,
                    IsNullable = false,
                    SqlDbType = SqlDbType.Int,
                    Direction = ParameterDirection.Input
                };
            }
        }
        public SqlParameter NewStatus
        {
            get
            {
                object status = (filter.NewStatus.HasValue) ? (int)filter.NewStatus : (object)DBNull.Value;
                return new SqlParameter
                {
                    ParameterName = Constants.Sp_Param_NewStatus,
                    Value = status,
                    IsNullable = false,
                    SqlDbType = SqlDbType.Int,
                    Direction = ParameterDirection.Input
                };
            }
        }
        public SqlParameter CurrentStatus
        {
            get
            {
                object status = (filter.CurrentStatus.HasValue) ? (int)filter.CurrentStatus : (object)DBNull.Value;
                return new SqlParameter
                {
                    ParameterName = Constants.Sp_Param_CurrentStatus,
                    Value = status,
                    IsNullable = false,
                    SqlDbType = SqlDbType.Int,
                    Direction = ParameterDirection.Input
                };
            }
        }
        public SqlParameter Days
        {
            get
            {
                object days = (filter.Days.HasValue) ? filter.Days : (object)DBNull.Value;
                return new SqlParameter
                {
                    ParameterName = Constants.Sp_Param_Days,
                    Value = days,
                    IsNullable = true,
                    SqlDbType = SqlDbType.Int,
                    Direction = ParameterDirection.Input
                };
            }
        }

        public SqlParameter AlertArea
        {
            get
            {
                object alertArea = (filter.AlertArea.HasValue) ? filter.AlertArea : (object)DBNull.Value;
                return new SqlParameter
                {
                    ParameterName = Constants.Sp_Param_AlertArea,
                    Value = alertArea,
                    IsNullable = true,
                    SqlDbType = SqlDbType.Int,
                    Direction = ParameterDirection.Input
                };
            }
        }
        public SqlParameter Comments
        {
            get
            {
                object comments = !string.IsNullOrEmpty(filter.Comments) ? filter.Comments : (object)DBNull.Value;
                return new SqlParameter
                {
                    ParameterName = Constants.Sp_Param_Comments,
                    Value = comments,
                    IsNullable = true,
                    SqlDbType = SqlDbType.VarChar,
                    Direction = ParameterDirection.Input
                };
            }
        }
        public SqlParameter TrafficProblems
        {
            get
            {
                object trafficProblems = (filter.TrafficProblems.HasValue) ? filter.TrafficProblems : (object)DBNull.Value;
                return new SqlParameter
                {
                    ParameterName = Constants.Sp_Param_TrafficProblems,
                    Value = trafficProblems,
                    IsNullable = true,
                    SqlDbType = SqlDbType.Bit,
                    Direction = ParameterDirection.Input
                };
            }
        }
        public SqlParameter Location
        {
            get
            {
                object location = !string.IsNullOrEmpty(filter.Location) ? filter.Location : (object)DBNull.Value;
                return new SqlParameter
                {
                    ParameterName = Constants.Sp_Param_Location,
                    Value = location,
                    IsNullable = true,
                    SqlDbType = SqlDbType.VarChar,
                    Direction = ParameterDirection.Input
                };
            }
        }
        public SqlParameter CenterCoordinates
        {
            get
            {
                object centerCoordinates = !string.IsNullOrEmpty(filter.CenterCoordinates) ? filter.CenterCoordinates : (object)DBNull.Value;
                return new SqlParameter
                {
                    ParameterName = Constants.Sp_Param_CenterCoordinates,
                    Value = centerCoordinates,
                    IsNullable = true,
                    SqlDbType = SqlDbType.VarChar,
                    Direction = ParameterDirection.Input
                };
            }
        }
        public SqlParameter AreaCoordinates
        {
            get
            {
                object areaCoordinates = !string.IsNullOrEmpty(filter.AreaCoordinates) ? filter.AreaCoordinates : (object)DBNull.Value;
                return new SqlParameter
                {
                    ParameterName = Constants.Sp_Param_AreaCoordinates,
                    Value = areaCoordinates,
                    IsNullable = true,
                    SqlDbType = SqlDbType.VarChar,
                    Direction = ParameterDirection.Input
                };
            }
        }
        public SqlParameter NetworkOperatorId
        {
            get
            {
                object networkOperatorId = (filter.NetworkOperatorId.HasValue) ? filter.NetworkOperatorId : (object)DBNull.Value;
                return new SqlParameter
                {
                    ParameterName = Constants.Sp_Param_NetworkOperatorId,
                    Value = networkOperatorId,
                    IsNullable = true,
                    SqlDbType = SqlDbType.Int,
                    Direction = ParameterDirection.Input
                };
            }
        }
        public SqlParameter AlertCode
        {
            get
            {
                object alertCode = !string.IsNullOrEmpty(filter.AlertCode) ? filter.AlertCode : (object)DBNull.Value;
                return new SqlParameter
                {
                    ParameterName = Constants.Sp_Param_AlertCode,
                    Value = alertCode,
                    IsNullable = true,
                    SqlDbType = SqlDbType.VarChar,
                    Direction = ParameterDirection.Input
                };
            }
        }
        public SqlParameter ContractorId
        {
            get
            {
                object contractorId = (filter.ContractorId.HasValue) ? filter.ContractorId : (object)DBNull.Value;
                return new SqlParameter
                {
                    ParameterName = Constants.Sp_Param_ContractorId,
                    Value = contractorId,
                    IsNullable = true,
                    SqlDbType = SqlDbType.Int,
                    Direction = ParameterDirection.Input
                };
            }
        }
        public SqlParameter Unit
        {
            get
            {
                object unit = (filter.Unit.HasValue) ? filter.Unit : (object)DBNull.Value;
                return new SqlParameter
                {
                    ParameterName = Constants.Sp_Param_Unit,
                    Value = unit,
                    IsNullable = true,
                    SqlDbType = SqlDbType.Int,
                    Direction = ParameterDirection.Input
                };
            }
        }
        public SqlParameter Price
        {
            get
            {
                object price = (filter.Price.HasValue) ? filter.Price : (object)DBNull.Value;
                return new SqlParameter
                {
                    ParameterName = Constants.Sp_Param_Price,
                    Value = price,
                    IsNullable = true,
                    SqlDbType = SqlDbType.Float,
                    Direction = ParameterDirection.Input
                };
            }
        }
        public SqlParameter MaterialsId
        {
            get
            {
                object materialsId = (filter.MaterialsId.HasValue) ? filter.MaterialsId : (object)DBNull.Value;
                return new SqlParameter
                {
                    ParameterName = Constants.Sp_Param_MaterialsId,
                    Value = materialsId,
                    IsNullable = true,
                    SqlDbType = SqlDbType.Int,
                    Direction = ParameterDirection.Input
                };
            }
        }
        public SqlParameter FirstName
        {
            get
            {
                object firstName = !string.IsNullOrEmpty(filter.FirstName) ? filter.FirstName : (object)DBNull.Value;
                return new SqlParameter
                {
                    ParameterName = Constants.Sp_Param_FirstName,
                    Value = firstName,
                    IsNullable = true,
                    SqlDbType = SqlDbType.VarChar,
                    Direction = ParameterDirection.Input
                };
            }
        }
        public SqlParameter OldPassword
        {
            get
            {
                object oldpassword = !string.IsNullOrEmpty(filter.OldPassword) ? filter.OldPassword : (object)DBNull.Value;
                return new SqlParameter
                {
                    ParameterName = Constants.Sp_Param_OldPassword,
                    Value = oldpassword,
                    IsNullable = true,
                    SqlDbType = SqlDbType.VarChar,
                    Direction = ParameterDirection.Input
                };
            }
        }
        public SqlParameter NewPassword
        {
            get
            {
                object newpassword = !string.IsNullOrEmpty(filter.NewPassword) ? filter.NewPassword : (object)DBNull.Value;
                return new SqlParameter
                {
                    ParameterName = Constants.Sp_Param_NewPassword,
                    Value = newpassword,
                    IsNullable = true,
                    SqlDbType = SqlDbType.VarChar,
                    Direction = ParameterDirection.Input
                };
            }
        }
        public SqlParameter LastName
        {
            get
            {
                object lastName = !string.IsNullOrEmpty(filter.LastName) ? filter.LastName : (object)DBNull.Value;
                return new SqlParameter
                {
                    ParameterName = Constants.Sp_Param_LastName,
                    Value = lastName,
                    IsNullable = true,
                    SqlDbType = SqlDbType.VarChar,
                    Direction = ParameterDirection.Input
                };
            }
        }
        public SqlParameter Phone1
        {
            get
            {
                object phone1 = !string.IsNullOrEmpty(filter.Phone1) ? filter.Phone1 : (object)DBNull.Value;
                return new SqlParameter
                {
                    ParameterName = Constants.Sp_Param_Phone1,
                    Value = phone1,
                    IsNullable = true,
                    SqlDbType = SqlDbType.VarChar,
                    Direction = ParameterDirection.Input
                };
            }
        }
        public SqlParameter Phone2
        {
            get
            {
                object phone2 = !string.IsNullOrEmpty(filter.Phone2) ? filter.Phone2 : (object)DBNull.Value;
                return new SqlParameter
                {
                    ParameterName = Constants.Sp_Param_Phone2,
                    Value = phone2,
                    IsNullable = true,
                    SqlDbType = SqlDbType.VarChar,
                    Direction = ParameterDirection.Input
                };
            }
        }
        public SqlParameter Email
        {
            get
            {
                object email = !string.IsNullOrEmpty(filter.Email) ? filter.Email : (object)DBNull.Value;
                return new SqlParameter
                {
                    ParameterName = Constants.Sp_Param_Email,
                    Value = email,
                    IsNullable = true,
                    SqlDbType = SqlDbType.VarChar,
                    Direction = ParameterDirection.Input
                };
            }
        }
        public SqlParameter Login
        {
            get
            {
                object login = !string.IsNullOrEmpty(filter.Login) ? filter.Login : (object)DBNull.Value;
                return new SqlParameter
                {
                    ParameterName = Constants.Sp_Param_Login,
                    Value = login,
                    IsNullable = true,
                    SqlDbType = SqlDbType.VarChar,
                    Direction = ParameterDirection.Input
                };
            }
        }
        public SqlParameter Password
        {
            get
            {
                object password = !string.IsNullOrEmpty(filter.Password) ? filter.Password : (object)DBNull.Value;
                return new SqlParameter
                {
                    ParameterName = Constants.Sp_Param_Password,
                    Value = password,
                    IsNullable = true,
                    SqlDbType = SqlDbType.VarChar,
                    Direction = ParameterDirection.Input
                };
            }
        }
        public SqlParameter Confirmation
        {
            get
            {
                object confirmation = filter.Confirmation;
                return new SqlParameter
                {
                    ParameterName = Constants.Sp_Param_Confirmation,
                    Value = confirmation,
                    IsNullable = false,
                    SqlDbType = SqlDbType.Bit,
                    Direction = ParameterDirection.Input
                };
            }
        }
        public SqlParameter Notification
        {
            get
            {
                object notification = filter.Notification;
                return new SqlParameter
                {
                    ParameterName = Constants.Sp_Param_Notification,
                    Value = notification,
                    IsNullable = false,
                    SqlDbType = SqlDbType.Bit,
                    Direction = ParameterDirection.Input
                };
            }
        }
        public SqlParameter Disabled
        {
            get
            {
                object disabled = filter.Disabled;
                return new SqlParameter
                {
                    ParameterName = Constants.Sp_Param_Disabled,
                    Value = disabled,
                    IsNullable = false,
                    SqlDbType = SqlDbType.Bit,
                    Direction = ParameterDirection.Input
                };
            }
        }
        public SqlParameter PostCity
        {
            get
            {
                object city = !string.IsNullOrEmpty(filter.PostCity) ? filter.PostCity : (object)DBNull.Value;
                return new SqlParameter
                {
                    ParameterName = Constants.Sp_Param_City,
                    Value = city,
                    IsNullable = true,
                    SqlDbType = SqlDbType.VarChar,
                    Direction = ParameterDirection.Input
                };
            }
        }
        public SqlParameter PostCode
        {
            get
            {
                object postcode = !string.IsNullOrEmpty(filter.PostCode) ? filter.PostCode : (object)DBNull.Value;
                return new SqlParameter
                {
                    ParameterName = Constants.Sp_Param_PostCode,
                    Value = postcode,
                    IsNullable = true,
                    SqlDbType = SqlDbType.VarChar,
                    Direction = ParameterDirection.Input
                };
            }
        }
        public SqlParameter PostAddress
        {
            get
            {
                object postaddress = !string.IsNullOrEmpty(filter.PostAddress) ? filter.PostAddress : (object)DBNull.Value;
                return new SqlParameter
                {
                    ParameterName = Constants.Sp_Param_PostAddress,
                    Value = postaddress,
                    IsNullable = true,
                    SqlDbType = SqlDbType.VarChar,
                    Direction = ParameterDirection.Input
                };
            }
        }
        public SqlParameter Name
        {
            get
            {
                object name = !string.IsNullOrEmpty(filter.Name) ? filter.Name : (object)DBNull.Value;
                return new SqlParameter
                {
                    ParameterName = Constants.Sp_Param_Name,
                    Value = name,
                    IsNullable = true,
                    SqlDbType = SqlDbType.VarChar,
                    Direction = ParameterDirection.Input
                };
            }
        }
        public SqlParameter Code
        {
            get
            {
                object code = !string.IsNullOrEmpty(filter.Code) ? filter.Code : (object)DBNull.Value;
                return new SqlParameter
                {
                    ParameterName = Constants.Sp_Param_Code,
                    Value = code,
                    IsNullable = true,
                    SqlDbType = SqlDbType.VarChar,
                    Direction = ParameterDirection.Input
                };
            }
        }
        public SqlParameter TrafficComments
        {
            get
            {
                object trafficcomments = !string.IsNullOrEmpty(filter.TrafficComments) ? filter.TrafficComments : (object)DBNull.Value;
                return new SqlParameter
                {
                    ParameterName = Constants.Sp_Param_TrafficComments,
                    Value = trafficcomments,
                    IsNullable = true,
                    SqlDbType = SqlDbType.VarChar,
                    Direction = ParameterDirection.Input
                };
            }
        }
        public SqlParameter StartFee
        {
            get
            {
                object startfee = (filter.StartFee.HasValue) ? filter.StartFee : (object)DBNull.Value;
                return new SqlParameter
                {
                    ParameterName = Constants.Sp_Param_StartFee,
                    Value = startfee,
                    IsNullable = true,
                    SqlDbType = SqlDbType.Float,
                    Direction = ParameterDirection.Input
                };
            }
        }
        public SqlParameter ConstructorPrice
        {
            get
            {
                object constructorprice = (filter.ConstructorPrice.HasValue) ? filter.ConstructorPrice : (object)DBNull.Value;
                return new SqlParameter
                {
                    ParameterName = Constants.Sp_Param_ConstructorPrice,
                    Value = constructorprice,
                    IsNullable = true,
                    SqlDbType = SqlDbType.Float,
                    Direction = ParameterDirection.Input
                };
            }
        }
        public SqlParameter Archive
        {
            get
            {
                object archive = filter.Archive;
                return new SqlParameter
                {
                    ParameterName = Constants.Sp_Param_Archive,
                    Value = archive,
                    IsNullable = true,
                    SqlDbType = SqlDbType.Bit,
                    Direction = ParameterDirection.Input
                };
            }
        }

        private string ConvertIntToString(Int32 intParameter)
        {
            return ((Int32)intParameter).ToString();
        }
    }
}
